#include <boost/shared_ptr.hpp>


namespace PimplImplementation
{
	template<typename T>
	class Weak_ptr_Impl;

template<typename T>
class Shared_ptr_Impl
{
	template<typename T>
	friend class PimplImplementation::Weak_ptr_Impl;
	template<typename Y>
	friend class Shared_ptr_Impl;

public:
	Shared_ptr_Impl()
		: m_ptr()
	{

	}

	Shared_ptr_Impl( const Shared_ptr_Impl<T>& o )
		: m_ptr( o.m_ptr )
	{

	}

	template<typename Y>
	Shared_ptr_Impl( const Shared_ptr_Impl<Y>& o )
		: m_ptr( boost::static_pointer_cast<T>( o.m_ptr ) )
	{

	}

	Shared_ptr_Impl( const PimplImplementation::Weak_ptr_Impl<T>& o )
		: m_ptr( o.m_ptr )
	{

	}

	Shared_ptr_Impl( T* o )
		: m_ptr( o )
	{

	}

	T* Get() const
	{
		return m_ptr.get();
	}


	T& operator*() const
	{
		return *m_ptr;
	}

	const Shared_ptr_Impl<T>& operator=( const Shared_ptr_Impl<T>& rhs )
	{
		m_ptr = rhs.m_ptr;
		return *this;
	}

	unsigned int UseCount() const
	{
		return m_ptr.use_count();
	}

private:
	boost::shared_ptr<T>		m_ptr;
};

}
